<template>
	<view>
		<view class="fenleiCla">
			<view class="topCla">
				<view class="">
					<view class="yijiCla" v-if="yijiShow">请选择一级分类</view>
					<view class="yijiFullName1Cla" v-else>
						<text @click="yijiFullName1Click">{{FullName1}}</text>
						<u-icon class="iconCla" name="arrow-right" size="8"></u-icon>
					</view>
				</view>
				<view class="">
					<view class="yijiCla" v-if="!erjiShow">请选择二级分类</view>
					<view class="yijiFullName1Cla" v-else-if="erjiShow && !yijiShow">
						<text @click="erjiFullName2Click">{{FullName2}}</text>
						<u-icon class="iconCla" name="arrow-right" size="8"></u-icon>
					</view>
				</view>
				<view class="">
					<view class="yijiCla" v-if="!sanjiShow">请选择三级分类</view>
				</view>
			</view>
			<view class="bottomCla">
				<view class="" v-if="yijiShow">
					<view class="itemCla" v-for="(item,index) in list" :key="index" @click="yijiClick(item)">
						{{item.FullName}}
					</view>
				</view>
				<view class="" v-if="!erjiShow">
					<view class="itemCla" v-for="(item,index) in list2" :key="index" @click="erjiClick(item)">
						{{item.FullName}}
					</view>
				</view>
				<view class="" v-if="!sanjiShow">
					<view class="itemCla" v-for="(item,index) in list3" :key="index" @click="sanjiClick(item)">
						{{item.FullName}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				erjiShow:true,
				yijiShow:true,
				sanjiShow:true,
				list: [],
				FullName1: '',
				list2: [],
				FullName2: '',
				list3: [],
				obj:{
					Id:[],
					FullName:'',
				},
			}
		},
		created(){
			this.PositionLab();
		},
		methods: {
			PositionLab() {
				this.$http.huirc.jobcategorytree().then((res) => {
					if (res.Success) {
						this.list = res.Result
					}
				});
			},
			yijiClick(item) {
				
				this.obj.Id.push(item.Id)
				
				this.FullName1 = item.FullName;
				this.yijiShow = !this.yijiShow;
				this.list2 = item.Children;
				this.erjiShow = !this.erjiShow;
			},
			erjiClick(item) {
				
				this.obj.Id.push(item.Id)
				
				this.FullName2 = item.FullName;
				this.erjiShow = !this.erjiShow;
				this.list3 = item.Children;
				this.sanjiShow = !this.sanjiShow;
			},
			sanjiClick(item) {
				this.obj.Id.push(item.Id)
				this.obj.FullName = item.FullName;
				this.$emit('sortSelectionEmit',this.obj)
			},
			yijiFullName1Click() {
				this.erjiShow = true;
				this.yijiShow = true;
				this.sanjiShow = true;
			},
			erjiFullName2Click() {
				this.erjiShow = false;
				this.sanjiShow = true;
			},
		}
	}
</script>

<style lang="scss" scoped>
.fenleiCla {
				.topCla {
					margin: 60rpx 0 20rpx;
					display: flex;
					align-items: center;

					.yijiCla {
						font-weight: 500;
						color: #3476FE;
					}

					.yijiFullName1Cla {
						font-weight: 500;
						color: #666666;
						font-size: 28rpx;
						display: flex;
						align-items: center;

						.iconCla {
							margin: 0 20rpx;
						}
					}
				}

				.bottomCla {
					margin-bottom: 20rpx;

					.itemCla {
						padding: 20rpx 0;
						border-bottom: 1rpx solid #E2E2E2;
					}
				}
			}
</style>
